var pageContext = new PageContextDatatable(settings||{});

pageContext.formInit = function(layero){
}

pageContext.toAdd = function(option){
	var action = window.global.getFinalUrl(pageContext.setting.toAddUrl);
	load(action,"page-content",true,"新增"+pageContext.modelName,function(){
		
	});
}
pageContext.toDetail = function(id,data){
	var action = window.global.getFinalUrl(pageContext.setting.toDetailUrl);
	action = window.global.addPara(action,"id",id,true)
	load(action,"page-content",true,pageContext.modelName+"详情",function(){
		
	});
}
pageContext.toUpdate = function(id,data){
	var action = window.global.getFinalUrl(pageContext.setting.toUpdateUrl);
	action = window.global.addPara(action,"id",id,true)
	load(action,"page-content",true,"修改"+pageContext.modelName,function(){
		
	});
}
pageContext.resetFormAfter = function (){
	$("#searchForm select").val(null).trigger("change"); 
}
jQuery(function($) {
	pageContext.init();

	 $(document).find("input").each(function(){
		 $(this).attr("autocomplete","off");
	 });
	   var layero = $("#searchForm");
		layero.find('select[novalid!="true"]').each(function(){
			var novalid = $(this).attr("noconvert");
			if(novalid!="true"){
				var $span = layero.find(this).select2({
		            language: "zh-CN"
			            ,matcher:select2Matcher})
		            .next("span")
		            ;
			}
		  });
})
